package exception_exercise;

import java.io.FileOutputStream;
import java.io.IOException;

public class FinallyDemo21 {
    public static void main(String[] args) {
        System.out.println("程序开始");
        FileOutputStream fos1=null;
        try{
            fos1 =new FileOutputStream("./a/b/fos1.dat");
            fos1.write(1);
        }catch (IOException e1){
            System.out.println("出现IO异常并解决了");
        }finally {
           try{
               fos1.close();
           }catch (Exception e1){
               System.out.println("关闭流时出现异常并解决了");
           }
        }
        System.out.println("程序结束");
    }
}
